< previous page page_621 next page >

Page 621
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub Form_Load()
   Set tbrMain.ImageList = milsList

   Call ToolBarCreate
End Sub
Next, a routine named ToolBarCreate is called to build the Button objects for this toolbar:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub ToolBarCreate()
   Dim oBtn As Button

   With tbrMain
      Set oBtn = .Buttons.Add(, "NewRecord", "", _
                            tbrDefault, "NewRecord")
      oBtn.ToolTipText = "New"
      Set oBtn = .Buttons.Add(, "SaveRecord", , _
                            , "SaveRecord")
      oBtn.ToolTipText = "Save"
      Set oBtn = .Buttons.Add(, "DeleteRecord", , _
                            , "DeleteRecord")
      oBtn.ToolTipText = "Delete"
      Set oBtn = .Buttons.Add(, "UndoRecord", , _
                            , "Undo")
      oBtn.ToolTipText = "Undo"

      Set oBtn = .Buttons.Add(, , _
                            , tbrSeparator)

      Set oBtn = .Buttons.Add(, "Exit", , _
                            , "Exit")
      oBtn.ToolTipText = "Exit"

   End With
End Sub
To add buttons on the toolbar, you invoke the Add method on the Buttons collection of the toolbar. The first parameter is the Index number. Because youll generally not use this, you can just skip this parameter. The second parameter is the Key value to call this button. The third parameter is the caption, if any, for this particular button. The fourth parameter is the style for this button. You can use any of the

 
< previous page page_621 next page >

If you like this book, buy it!